package com.demo.spring.formework.aop.aspect;

import com.demo.spring.formework.aop.QBMethodInvocation;

import java.lang.reflect.Method;

public class QBAfterThrowingAdvice extends QBAbstractAspectJAdvice implements QBAdvise,QBMethodInterceptor {

    private String throwingName;
    private QBMethodInvocation mi;

    public QBAfterThrowingAdvice(Method aspectMethod, Object aspectTarget) {
        super(aspectMethod, aspectTarget);
    }

    public void setThrowingName(String name) {
        this.throwingName = name;
    }

    public Object invoke(QBMethodInvocation mi) throws Throwable {
        try {
            return mi.proceed();
        }catch (Exception e){
            invokeAdviceMethod(mi,null,e);
            throw e;
        }
    }
}
